Libs Utils - GDAL

May, 2018, Mauro Alberti, alberti.m65@gmail.com

1. Examples


In [8]:
from pygsf.libs_utils.gdal.gdal import *

Reading an example data


In [9]:
data_path = "/home/mauro/Documents/projects/gsf/pygsf/example_data/vx.asc"  # change accordingly

In [10]:
dataset, geotransform, num_bands, projection = read_raster(data_path)

In [11]:
band_params, band_array = read_band(dataset, 1)

In [12]:
print("Geotransform: {}".format(geotransform))
print("Number of bands: {}".format(num_bands))
print("Projection: {}".format(projection))
print("Data type: {}".format(band_params["dataType"]))
print("Unit type: {}".format(band_params["unitType"]))
print("Statistics: {}".format(band_params["stats"]))
print("No data value: {}".format(band_params["noData"]))
print("Number of overviews: {}".format(band_params["numOverviews"]))
print("Number of color table entries: {}".format(band_params["numColorTableEntries"]))


Geotransform: [ 5.8666140e+05  3.5620000e+02  0.0000000e+00  1.7072666e+06
  0.0000000e+00 -3.5620000e+02]
Number of bands: 1
Projection: 
Data type: Float32
Unit type: 
Statistics: {'mean': 0.0, 'max': 0.0, 'min': 0.0, 'std_dev': -1.0}
No data value: -9999.0
Number of overviews: 0
Number of color table entries: 0